package com.last.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.last.entity.Order;
import com.last.entity.Result;
import com.last.entity.User;
import com.last.mapper.OrderMapper;
import com.last.mapper.UserMapper;
import com.last.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements IUserService {

  @Autowired
  private UserMapper userMapper;

    @Override
    public Result<User> detailsByUserId(Integer userId) {
        if (userId.equals("") || userId == null){
         // 当用户名为空
            return new Result<>(false,"请规范输入");
        }
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id",userId);
        User user = userMapper.selectOne(queryWrapper);
        Result<User> result = new Result<>(true, "ok", user);
        return result;
    }
}
